package net.csdn.business.common.feign.webhook;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.csdn.business.common.constant.ServiceNameConstants;
import net.csdn.business.common.domain.query.WebhookLogQuery;
import net.csdn.business.common.domain.vo.WebhookLogVO;
import net.csdn.business.common.feign.webhook.config.WebHookFeignConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

/**
 * @Auther: zhangyalei
 * @Date: 2023/04/23 16:59
 * @Description: webhook日志相关api
 */
@FeignClient(value = ServiceNameConstants.ATOMGIT_WEBHOOK_SERVICE, contextId = ServiceNameConstants.ATOMGIT_WEBHOOK_LOG_CONTEXT_ID,configuration = WebHookFeignConfiguration.class)
public interface WebHookLogFeignClient {
    /**
     * 分页查询webhook通知日志列表
     */
    @PostMapping("/api/v1/webhook/log/list")
    public Page<WebhookLogVO> findLogPageList(@RequestBody WebhookLogQuery query);

    /**
     * 根据id获取webhook通知日志详细信息
     */
    @GetMapping(value = "/api/v1/webhook/log/{id}")
    public WebhookLogVO getLogInfo(@PathVariable("id") String id);

    /**
     * 根据webhookId获取webhook最近一次的通知状态
     */
    @GetMapping(value = "/api/v1/webhook/log/lastDelivery/{webhookId}")
    public Map<String,Object> getLastDelivery(@PathVariable("webhookId") String webhookId);

}